package com.molichuxing.gateway.exception;

import java.util.HashMap;
import java.util.Map;

public enum OrderBffExceptionCodeEnum {
	/**
	 * 您有待付款的加购里程包订单
	 */
	PURCHASED_EXIST(20501, "您有待付款的加购里程包订单"),
	/**
	 * 您有待付款的续订订单
	 */
	RENEW_WAIT_EXIST(20502, "您有待付款的续订订单"),
	/**
	 * 不可加购、续订
	 */
	CANNOT_RELET(20503, "不可加购、续订"),

	/**
	 * 抱歉，您名下已有订单尚未完成，暂时无法下单
	 */
	HAVE_ORDER(20504, "抱歉，您名下已有订单尚未完成，暂时无法下单");

	final static private Map<Integer, OrderBffExceptionCodeEnum> MAP = new HashMap<Integer, OrderBffExceptionCodeEnum>() {
		private static final long serialVersionUID = -8414553247670306999L;
		{
			OrderBffExceptionCodeEnum[] enums = OrderBffExceptionCodeEnum.values();
			for (OrderBffExceptionCodeEnum OrderExceptionCodeEnum : enums) {
				put(OrderExceptionCodeEnum.getCode(), OrderExceptionCodeEnum);
			}
		}
	};

	public static OrderBffExceptionCodeEnum getEnum(Integer code) {
		return MAP.get(code);
	}

	public static String getEnumDesc(Integer code) {
		OrderBffExceptionCodeEnum OrderExceptionCodeEnum = MAP.get(code);
		if (OrderExceptionCodeEnum != null) {
			return OrderExceptionCodeEnum.getMessage();
		}
		return "";
	}

	private Integer code;

	private String message;

	public Integer getCode() {
		return code;
	}

	public void setCode(Integer code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	private OrderBffExceptionCodeEnum(Integer code, String message) {
		this.code = code;
		this.message = message;
	}
}
